package com.example.demo.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentImageMapper {
    @Insert("insert into comment_image (comment_id, url, create_time, update_time) values (#{commentId}, #{url}, now(), now())")
    boolean addCommentImage(Long commentId, String url);

    @Delete("delete from comment_image where comment_id = #{commentId}")
    boolean deleteCommentImage(Long commentId);

    @Select("select url from comment_image where comment_id = #{commentId} order by id")
    List<String> selectCommentImagesByCommentId(Long commentId);
}
